import { defineStore } from "pinia";
import { ref } from "vue";

export const useAppStore = defineStore("app", () => {
  // 侧边栏折叠状态
  const sidebarCollapsed = ref(false);

  // 设置侧边栏折叠状态
  const toggleSidebar = () => {
    sidebarCollapsed.value = !sidebarCollapsed.value;
  };

  // 系统设置
  const settings = ref({
    title: "棋牌室后台管理系统",
    theme: "light",
    showTagsView: true,
    fixedHeader: true,
  });

  // 更新系统设置
  const updateSettings = (newSettings) => {
    settings.value = {
      ...settings.value,
      ...newSettings,
    };
  };

  return {
    sidebarCollapsed,
    toggleSidebar,
    settings,
    updateSettings,
  };
});
